#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

int main(int argc, char const *argv[])
{
	int t;
	cin >> t;
	for (int kk=0; kk<t; ++kk)
	{
		int n, k1, k2, x;
		cin >> n >> k1 >> k2;
		int x1 = 0, x2 = 0;
		for (int i=0; i<k1; ++i)
		{
			cin >> x;
			x1 = max(x1, x);
		}
		for (int i=0; i<k2; ++i)
		{
			cin >> x;
			x2 = max(x, x2);
		}
		if (x1 > x2) puts("YES");
		else puts("NO");

	}
	return 0;
}